package org.zerta.troops.server;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JScrollPane;


public class TroopsServerUI extends JFrame implements ActionListener {

	static final long serialVersionUID = 1L;
	
	ServerPanel serverPanel;
	JScrollPane serverScrollPane;
	TroopsServer troopsServer;
	
	public TroopsServerUI (TroopsServer troopsServer) {
		super("Troops Server");
		
		this.troopsServer = troopsServer;
		
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
        setLayout(new BorderLayout());
        
        serverPanel = new ServerPanel(troopsServer);
        
        serverScrollPane = new JScrollPane(serverPanel);
        serverScrollPane.setMinimumSize(new Dimension(0,0));
        
        add(serverScrollPane);
        
        pack();
        setVisible(true);
        ServerConsole console = serverPanel.getConsole();
        troopsServer.setConsole(console);
	}
	
	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub

	}

}
